<?php
/**
 * @ClassName: Customer
 * @Description: TODO
 * @author: gydtrade
 * @Date: 2025-09-27 18:57
 * @Version: V1.0.0
 */

namespace app\api\controller\filters;

use app\api\controller\Api;
use app\common\model;
use app\common\enum\CommonEnum;
use app\common\enum\CustomerEnum;
use app\common\enum\RackEnum;

class Customer extends Api
{
    function getSelectData()
    {
        $customerTypeList = [];
        $serviceTypeList = [];
        $rackTypeList = [];
        $regularTypeList = [];
        $weeks = [];
        $elevatorTypeList = [];
        $monthSettleStatus = [];

        // 客户类型
        foreach (dict_data('customer_type') as $k => $item) {
            $customerTypeList[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        // 服务类型
        foreach (CustomerEnum::serviceTypes(true) as $k => $item) {
            $serviceTypeList[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        // 架子规格
        foreach (RackEnum::rackTypes(true) as $k => $item) {
            $rackTypeList[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        // 常规类型
        foreach (CustomerEnum::regularTypes(true) as $k => $item) {
            $regularTypeList[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        // 星期
        foreach (CommonEnum::weeks(true) as $k => $item) {
            $weeks[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        // 有无电梯
        foreach (CustomerEnum::elevatorTypes(true) as $k => $item) {
            $elevatorTypeList[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        // 月结状态
        foreach (CustomerEnum::monthSettleStatus(true) as $k => $item) {
            $monthSettleStatus[] = [
                'value' => $k,
                'label' => $item,
            ];
        }

        $result = [
            'customerTypeList' => $customerTypeList,
            'serviceTypeList' => $serviceTypeList,
            'rackTypeList' => $rackTypeList,
            'regularTypeList' => $regularTypeList,
            'weeks' => $weeks,
            'elevatorTypeList' => $elevatorTypeList,
            'monthSettleStatus' => $monthSettleStatus,
        ];

        return json(["code" => 1, "msg" => "获取成功", "data" => $result]);
    }

}